package com.huawei.cyc;

import java.util.Random;
import java.util.Scanner;

public class Stjdb {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Random newRom=new Random();
        int ranDom=newRom.nextInt(3);
        String compPrint="",scanSting="";
        compPrint=reVsion(ranDom);
        int scanInt=0;
        System.out.println("你出什么？（2（石头）、1（剪刀）、0（布）");
        scanInt=s.nextInt();
        scanSting=reVsion(scanInt);
        if (scanInt==ranDom){
            System.out.println("计算机出的是："+compPrint+",你出"+scanSting+",平局");
        }
        else if((scanInt>ranDom&&ranDom!=0)||(scanInt>ranDom&&(ranDom==0&&scanInt==1))||(scanInt==0&&ranDom==2))
            System.out.println("计算机出的是："+compPrint+",你出"+scanSting+",你赢了");
        else
            System.out.println("计算机出的是："+compPrint+",你出"+scanSting+",你输了");
    }

    private static String reVsion(int ranDom) {
        String compPrint="";
        if (ranDom==0)
            compPrint="布";
        else if (ranDom==1)
            compPrint="剪刀";
        else
            compPrint="石头";
        return compPrint;
    }
}
